﻿<!doctype html>
<html>
<head>
    <title>SpreadJS - Style</title>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    
    <link href="../../../external/spreadjs/css/gcspread.sheets.excel2013white.9.40.20161.0.css" rel="stylesheet" type="text/css" />

    <script src="../../../external/external/jquery-1.8.2.min.js" type="text/javascript"></script>

    <script type="text/javascript" src="../../../external/spreadjs/gcspread.sheets.all.9.40.20161.0.min.js"></script>

    <script id="scriptInit" type="text/javascript">
    /*code_begin*/
        $(document).ready(function () {
            var spread = new GcSpread.Sheets.Spread(document.getElementById("ss"));
            var spreadNS = GcSpread.Sheets;
            var sheet = spread.getSheet(0);
            sheet.isPaintSuspended(true);
            var cellStyle = new spreadNS.Style();
            cellStyle.backColor = "red";
            var rowStyle = new spreadNS.Style();
            rowStyle.backColor = "green";
            var columnStyle = new spreadNS.Style();
            columnStyle.backColor = "yellow";

            sheet.setText(4, 4, 'cell style', spreadNS.SheetArea.viewport);
            sheet.setStyle(4, 4, cellStyle, spreadNS.SheetArea.viewport);
            sheet.setStyle(4, -1, rowStyle, spreadNS.SheetArea.viewport);
            sheet.setStyle(9, -1, rowStyle, spreadNS.SheetArea.viewport);
            sheet.setStyle(-1, 4, columnStyle, spreadNS.SheetArea.viewport);

            cellStyle.name = 'style1';
            rowStyle.name = 'style2';
            columnStyle.name = 'style3';
            sheet.addNamedStyle(cellStyle);
            sheet.addNamedStyle(rowStyle);
            sheet.addNamedStyle(columnStyle);
            sheet.setText(1, 0, 'style1', spreadNS.SheetArea.viewport);
            sheet.setStyle(1, 0, sheet.getNamedStyle('style1'), spreadNS.SheetArea.viewport);
            sheet.setText(1, 1, 'style2', spreadNS.SheetArea.viewport);
            sheet.setStyle(1, 1, sheet.getNamedStyle('style2'), spreadNS.SheetArea.viewport);
            sheet.setText(1, 2, 'style3', spreadNS.SheetArea.viewport);
            sheet.setStyle(1, 2, sheet.getNamedStyle('style3'), spreadNS.SheetArea.viewport);
            sheet.isPaintSuspended(false);
        });
    /*code_end*/
    </script>
</head>
<body>
    <div class="sample-turtorial">
        <div id="ss" style="width:100%;height:450px;border: 1px solid gray;"></div>
    </div>
</body>
</html>